<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="js/jquery.min.js"></script>
</head>
<body>
<p>修改密码</p>
    <div>
        用户名：<input type="text" id="username"/><br>
        邮箱：<input type="email" id="email"/> <button onclick="sendEmail()">发送验证码</button>
        <br>
        验证码：<input type="number" id="emailCode"/>
        <button onclick="submitCode()">提交验证</button>
    </div>
<script>
    function sendEmail() {
        $.ajax({
           url:"/api/email/sendEmailCode/" + $("#username").val() + "/" + $("#email").val(),
           method: "GET",
           success:function (res) {
               console.log(res.data)
           }
        });
    }

    function submitCode() {
        $.ajax({
            url:"/api/email/matchCode",
            method: "POST",
            data: {
                code:$("#emailCode").val(),
                receiver:$("#email").val()
            },
            success:function (res) {
                if (res.code == 200) {
                    alert("验证通过")
                }
            }
        });
    }
</script>
</body>
</html>